//
//  KFDClient.h
//  KFD
//
//  Created by JIRENTIANXIANG on 6/5/15.
//  Copyright (c) 2015 KFD. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "KFDResponseBody.h"
#import "KFDModel.h"

#define KFDImageSizeExceedLimitNotification @"KFDImageSizeExceedLimit"

typedef NS_ENUM(NSInteger,KFDDiagramDataPeriod){
    KFDDiagramDataPeriod5Minutes=1,
    KFDDiagramDataPeriod15Minutes,
    KFDDiagramDataPeriod30Minutes,
    KFDDiagramDataPeriod1Hour
};

typedef NS_ENUM(NSInteger,KFDFeedbackType){
    KFDFeedbackTypeService=1,
    KFDFeedbackTypeError
};

typedef void(^KFDRequestFailureHandler)(KFDResponseBody* response);

typedef void(^KFDRegisterSuccessHandler)();
typedef void(^KFDGetCheckcodeSuccessHandler)();
typedef void(^KFDSetNicknameAndPasswordSuccessHandler)();
typedef void(^KFDGetMarketPriceSuccessHandler)(NSArray* marketPrices);
typedef void(^KFDGetDiagramDataWithTimeSuccessHandler)(NSArray* diagramData,NSNumber* time);
typedef void(^KFDGetTradingStrategiesSucessHandler)(NSArray* tradingStrategies);
typedef void(^KFDGetAliveNewsSuccessHandler)(NSArray* aliveNews);
typedef void(^KFDLoginSuccessHandler)();
typedef void(^KFDGetFinancialInfoSuccessHandler)(NSArray* financialData,NSArray* holidayForecasts,NSArray* financialEvents);
typedef void(^KFDGetDiagramDataSuccessHandler)(NSArray* diagramPoints);
typedef void(^KFDGetLiveUrlSuccessHandler)(NSString* url);
typedef void(^KFDGetAnnouncementListSuccessHandler)(NSArray* announcementList);
typedef void(^KFDGetAnnouncementSuccessHandler)(KFDAnnouncement* announcement);
typedef void(^KFDGetETFHoldingsSuccessHandler)(NSArray* holdings);
typedef void(^KFDUpdateAccountInfoSuccessHandler)();
typedef void(^KFDGetInvestmentCommunityPostsSuccessHandler)(NSArray* posts);
typedef void(^KFDPublishPostSuccessHandler)(NSString* postId);
typedef void(^KFDUploadInvestmentCommunityPostPictureSuccessHandler)(NSString* pictureId);
typedef void(^KFDPraiseInvestmentCommunityPostSuccessHandler)(NSInteger numberOfLikes);
typedef void(^KFDCancelPraiseInvestmentCommunityPostSuccessHandler)(NSInteger numberOfLikes);
typedef void(^KFDGetPreferentialActivitiesSuccessHandler)(NSArray* activities);
typedef void(^KFDGetAccountInfoSuccessHandler)(KFDAccountInfo* accountInfo);
typedef void(^KFDSetPasswordSuccessHandler)();
typedef void(^KFDGetFinancialServiceInterfaceSuccessHandler)(NSString* withdraw,NSString* injection);
typedef void(^KFDBindEmailSuccessHandler)();
typedef void(^KFDGetLivesSuccessHandler)(NSArray* rooms);
typedef void(^KFDGetFAQsSuccessHandler)(NSArray* faqs);
typedef void(^KFDGetAboutUseSuccessHandler)(KFDAboutUs* aboutUs);
typedef void(^KFDJoinPreferentialActivitySuccessHandler)();
typedef void(^KFDGetMyPreferentialActivitiesSuccessHandler)(NSArray* activities);
typedef void(^KFDCommentICPostSuccessHandler)();
typedef void(^KFDFeedbackSuccessHandler)();
typedef void(^KFDApplyForVIPSuccessHandler)();
typedef void(^KFDGetVIPInfoSuccessHandler)(BOOL isVIP,BOOL isQualifiedForVIP);
typedef void(^KFDGetAddressSuccessHandler)(NSDictionary* addressResource);
typedef void(^KFDGetTeachersSuccessHandler)(NSArray* teachers);
typedef void(^KFDChooseTeacherSuccessHandler)();
typedef void(^KFDClearChatLogSuccessHandler)();
typedef void(^KFDGetDetailedMarketPriceSuccessHandler)(KFDDetailedMarketPrice* price);
typedef void(^KFDGetBanksSuccessHandler)(NSArray* banks);
typedef void(^KFDGetFinancialCalendarDatesSuccessHandler)(NSArray* dates);
typedef void(^KFDUploadAvatarSuccessHandler)(NSString* avatarUrl);
typedef void(^KFDUploadImageSuccessHandler)(NSString* url);
typedef void(^KFDSetBankSuccessHandler)();
typedef void(^KFDGetFinancialServiceCookieSuccessHandler)(NSString* name,NSString* value);
typedef void(^KFDGetAuxiliaryFunctionSettingsSuccessHanler)(KFDAuxiliaryFunctionSettings* settings);
typedef void(^KFDUpdateAuxiliaryFunctionSettingsSuccessHandler)(KFDAuxiliaryFunctionSettings* settings);
typedef void(^KFDGetAlarmSettingsSuccessHandler)(KFDAlarmSettings* settings);
typedef void(^KFDUpdateAlarmSettingsSuccessHandler)();
typedef void(^KFDGetAlarmRingtoneSettingsSuccessHandler)(KFDAlarmRingtoneSettings* settings);
typedef void(^KFDUpdateAlarmRingtoneSettingsSuccessHandler)();
typedef void(^KFDVerifyCheckcodeSuccessHandler)(NSString* token);
typedef void(^KFDGetMessagesSuccessHandler)(NSArray* messages);
typedef void(^KFDCheckoutMessageSuccessHandler)(KFDMessage* message);
typedef void(^KFDGetChatsSuccessHandler)(NSArray* chats);
typedef void(^KFDGetAvatarListSuccessHandler)(NSArray* avatarList);

@interface KFDClient : NSObject

+(KFDClient*)sharedClient;

//--------------------------------------------------
// Me
//--------------------------------------------------
-(NSURLSessionTask*)registerWithPhoneNubmer:(NSString*)phoneNumber realName:(NSString*)realName checkcode:(NSString*)checkcode successHandler:(KFDRegisterSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)getCheckcodeWithType:(NSString*)type phoneNumber:(NSString*)phoneNumber successHandler:(KFDGetCheckcodeSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)verifyCheckcode:(NSString*)checkcode withType:(NSString*)type phoneNumber:(NSString*)phoneNumber successHandler:(KFDVerifyCheckcodeSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)setNickname:(NSString*)nickname password:(NSString*)password successHandler:(KFDSetNicknameAndPasswordSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)loginWithPhoneNumber:(NSString*)phoneNumber password:(NSString*)password successHandler:(KFDLoginSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)updateAccountInfoWithNickname:(NSString*)nickname province:(NSString*)province city:(NSString*)city avatar:(NSString*)avatar gender:(NSNumber*)gender clientId:(NSString*)clientId pushToken:(NSString*)pushToken successHandler:(KFDUpdateAccountInfoSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)getAccountInfoWithSuccessHandler:(KFDGetAccountInfoSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)setPassword:(NSString*)password token:(NSString*)token successHandler:(KFDSetPasswordSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)getFinancialServiceInterfaceWithSuccessHandler:(KFDGetFinancialServiceInterfaceSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)bindEmail:(NSString*)email successHandler:(KFDBindEmailSuccessHandler)successHandler failulreHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)getFAQsWithSuccessHandler:(KFDGetFAQsSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)getAboutUsWithSuccessHandler:(KFDGetAboutUseSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)getMyPreferentialActivitiesWithMaxCount:(NSUInteger)maxCount page:(NSUInteger)page successHandler:(KFDGetMyPreferentialActivitiesSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)feedbackWithType:(KFDFeedbackType)type content:(NSString*)content successHandler:(KFDFeedbackSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)getAddressWithSuccessHandler:(KFDGetAddressSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)clearChatLogWithSuccessHandler:(KFDClearChatLogSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)getBanksWithSuccessHandler:(KFDGetBanksSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)uploadAvatar:(UIImage*)avatar successHandler:(KFDUploadAvatarSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)uploadImage:(UIImage*)image type:(NSString*)type successHandler:(KFDUploadImageSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)setBankAccountInfo:(KFDBankAccountInfo*)bankInfo successHandler:(KFDSetBankSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)getFinancialServiceCookieWithSuccessHandler:(KFDGetFinancialServiceCookieSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)getAuxiliaryFunctionSettingsWithSuccessHandler:(KFDGetAuxiliaryFunctionSettingsSuccessHanler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)updateAuxiliaryFunctionSettings:(KFDAuxiliaryFunctionSettings*)settings successHandler:(KFDUpdateAuxiliaryFunctionSettingsSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHander;

-(NSURLSessionTask*)getMessagesWithMaxCountPerPage:(NSUInteger)maxCount page:(NSUInteger)page successHandler:(KFDGetMessagesSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)checkoutMessageWithId:(NSString*)messageId successHandler:(KFDCheckoutMessageSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)getChatsWithSuccessHandler:(KFDGetChatsSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)getAvatarListWithSuccessHandler:(KFDGetAvatarListSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;
//--------------------------------------------------




//--------------------------------------------------
// Market
//--------------------------------------------------
-(NSURLSessionTask*)getMarketPriceWithSucessHandler:(KFDGetMarketPriceSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)getDiagramDataWithType:(NSString*)type lastTime:(NSNumber*)lastTime successHandler:(KFDGetDiagramDataWithTimeSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)getLiveNewsWithMaxCountPerPage:(NSUInteger)count page:(NSUInteger)page successHandler:(KFDGetAliveNewsSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)getTradingStrategiesWithMaxCountPerPage:(NSUInteger)count page:(NSUInteger)page successHandler:(KFDGetTradingStrategiesSucessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)getFinancialInfoWithDate:(NSDate*)date successHandler:(KFDGetFinancialInfoSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)getDiagramDataWithType:(NSString*)type period:(KFDDiagramDataPeriod)period beforeTime:(NSInteger)time successHandler:(KFDGetDiagramDataSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)getAnnouncementListWithMaxCount:(NSUInteger)maxCount page:(NSUInteger)page successHandler:(KFDGetAnnouncementListSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)getAnnouncementWithId:(NSString*)id successHandler:(KFDGetAnnouncementSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)getDetailedMarketPriceOfType:(NSString*)type successHandler:(KFDGetDetailedMarketPriceSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)getFinancialCalendarDatesWithSuccessHandler:(KFDGetFinancialCalendarDatesSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)getAlarmSettingsWithType:(NSString*)type successHandler:(KFDGetAlarmSettingsSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)updateAlarmSettings:(KFDAlarmSettings*)settings successHandler:(KFDUpdateAlarmSettingsSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)getAlarmRingtoneSettingsWithSuccessHandler:(KFDGetAlarmRingtoneSettingsSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)updateAlarmRingtoneSettings:(KFDAlarmRingtoneSettings*)settings successHandler:(KFDUpdateAlarmRingtoneSettingsSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;
//--------------------------------------------------




//--------------------------------------------------
// Live
//--------------------------------------------------
//-(NSURLSessionTask*)getLiveUrlWithSuccessHandler:(KFDGetLiveUrlSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)getLiveRoomsWithSuccessHandler:(KFDGetLivesSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;
//--------------------------------------------------



//--------------------------------------------------
// Discovery
//--------------------------------------------------
-(NSURLSessionTask*)getETFHoldingsWithTypeId:(NSString*)typeId maxCount:(NSUInteger)maxCount page:(NSUInteger)page successHandler:(KFDGetETFHoldingsSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)getInvestmentCommunityPostsWithMaxCount:(NSUInteger)maxCount page:(NSUInteger)page successHandler:(KFDGetInvestmentCommunityPostsSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)publishInvestmentCommunityPostWithContent:(NSString*)content pictures:(NSArray*)pictures successHandler:(KFDPublishPostSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)uploadInvestmentCommunityPostPicture:(UIImage*)picture successHandler:(KFDUploadInvestmentCommunityPostPictureSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)praiseInvestmentCommunityPost:(NSString*)postId successHandler:(KFDPraiseInvestmentCommunityPostSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)cancelPraiseInvestmentCommunityPost:(NSString*)postId successHandler:(KFDCancelPraiseInvestmentCommunityPostSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

// 1-underway 2-finished
-(NSURLSessionTask*)getPreferentialActivitiesWithType:(NSString*)type maxCount:(NSUInteger)maxCount page:(NSUInteger)page successHandler:(KFDGetPreferentialActivitiesSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)joinPreferentialActivity:(NSString*)activityId successHandler:(KFDJoinPreferentialActivitySuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)commentICPost:(NSString*)postId userId:(NSString*)userId content:(NSString*)content successHandler:(KFDCommentICPostSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)getVIPInfoWithSuccessHandler:(KFDGetVIPInfoSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)applyForVIPWithSuccessHandler:(KFDApplyForVIPSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)getTeachersWithMaxCount:(NSUInteger)maxCount page:(NSUInteger)page successHandler:(KFDGetTeachersSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;

-(NSURLSessionTask*)chooseTeacher:(NSString*)teacherId successHandler:(KFDChooseTeacherSuccessHandler)successHandler failureHandler:(KFDRequestFailureHandler)failureHandler;
//--------------------------------------------------

@end
